import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:my_app/router/widget_router.dart';

const TextStyle btnts = TextStyle(fontSize: 16);

class WidgetDemoPage extends StatelessWidget {
  const WidgetDemoPage({super.key});


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Widget Demo")),
      body: Container(
        width: MediaQuery.of(context).size.width,
        height: double.infinity,
        color: const Color(0xFFEEEEEE),
        padding: const EdgeInsets.symmetric(horizontal: 16.0),
        child: SingleChildScrollView(
          child: Column(
            // 这是让按钮铺满的关键
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.tempPage.path),
                child: const Text("临时的demo页", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.btnTest.path),
                child: const Text("按钮测试页面", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.formTest.path),
                child: const Text("form表单demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.shoppingList.path),
                child: const Text("购物车demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.listTest.path),
                child: const Text("列表的demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.cardAndInput.path),
                child: const Text("卡片和输入控件的demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.maxheightAndScroll.path),
                child: const Text("支持最大高度可滚动demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.layoutTest.path),
                child: const Text("布局demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.mixedScroll.path),
                child: const Text("sliver 多种滚动组合", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.nestedScroll.path),
                child: const Text("sliver 滚动组合Nested", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.navigationBar.path),
                child: const Text("底部导航demo", style: btnts,)
              ),
              ElevatedButton(
                onPressed: () => _onTapBtn(context, WidgetRouters.navigationBarIndividual.path),
                child: const Text("个性化底部导航demo", style: btnts,)
              ),
              
            ],
          ),
        ),
      ),
    );
  }

  void _onTapBtn(BuildContext context, path) {
    context.push(path);
  }
}